package com.imut.lagain.entity;

import com.baomidou.mybatisplus.annotation.*;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.Max;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * 生理期记录实体类
 */
@TableName("menstrual_cycle")
public class MenstrualCycle {
    private static final Logger log = LoggerFactory.getLogger(MenstrualCycle.class);

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    
    /**
     * 用户ID
     */
    @NotNull(message = "用户ID不能为空")
    @TableField("user_id")
    private Long userId;
    
    /**
     * 生理期开始日期
     */
    @NotNull(message = "开始日期不能为空")
    @TableField("start_date")
    private LocalDate startDate;
    
    /**
     * 生理期结束日期
     */
    @TableField("end_date")
    private LocalDate endDate;
    
    /**
     * 周期长度（天数）
     */
    @Min(value = 21, message = "周期长度不能少于21天")
    @Max(value = 35, message = "周期长度不能超过35天")
    @TableField("cycle_length")
    private Integer cycleLength;
    
    /**
     * 经期持续天数
     */
    @Min(value = 3, message = "经期持续天数不能少于3天")
    @Max(value = 8, message = "经期持续天数不能超过8天")
    @TableField("period_length")
    private Integer periodLength;
    
    /**
     * 流量等级（1-轻微，2-正常，3-较多，4-很多）
     */
    @Min(value = 1, message = "流量等级最小为1")
    @Max(value = 4, message = "流量等级最大为4")
    @TableField("flow_level")
    private Integer flowLevel;
    
    /**
     * 症状描述（JSON格式存储）
     */
    @TableField("symptoms")
    private String symptoms;
    
    /**
     * 备注
     */
    @TableField("notes")
    private String notes;
    
    /**
     * 是否为预测数据
     */
    @TableField("is_predicted")
    private Boolean isPredicted = false;
    
    /**
     * 创建时间
     */
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private LocalDateTime createTime;
    
    /**
     * 更新时间
     */
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;
    
    /**
     * 是否删除
     */
    @TableLogic
    @TableField("is_deleted")
    private Boolean isDeleted = false;

    // Getters and Setters
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public LocalDate getStartDate() {
        return startDate;
    }

    public void setStartDate(LocalDate startDate) {
        this.startDate = startDate;
    }

    public LocalDate getEndDate() {
        return endDate;
    }

    public void setEndDate(LocalDate endDate) {
        this.endDate = endDate;
    }

    public Integer getCycleLength() {
        return cycleLength;
    }

    public void setCycleLength(Integer cycleLength) {
        this.cycleLength = cycleLength;
    }

    public Integer getPeriodLength() {
        return periodLength;
    }

    public void setPeriodLength(Integer periodLength) {
        this.periodLength = periodLength;
    }

    public Integer getFlowLevel() {
        return flowLevel;
    }

    public void setFlowLevel(Integer flowLevel) {
        this.flowLevel = flowLevel;
    }

    public String getSymptoms() {
        return symptoms;
    }

    public void setSymptoms(String symptoms) {
        this.symptoms = symptoms;
    }

    public String getNotes() {
        return notes;
    }

    public void setNotes(String notes) {
        this.notes = notes;
    }

    public Boolean getIsPredicted() {
        return isPredicted;
    }

    public void setIsPredicted(Boolean isPredicted) {
        this.isPredicted = isPredicted;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }

    public Boolean getIsDeleted() {
        return isDeleted;
    }

    public void setIsDeleted(Boolean isDeleted) {
        this.isDeleted = isDeleted;
    }
}